<?php

use think\Facade\Route;
use think\Facade\Env;

Route::domain(Env::get('app.api_url'), function () {

    header("Access-Control-Allow-Origin: *");
    header('Access-Control-Allow-Methods: POST, PUT, GET, OPTIONS, DELETE, HEAD, PATCH');
    header("Access-Control-Allow-Headers: token,language, Origin, X-Requested-With, Content-Type, Accept");

    Route::miss(function () {
        echo '无访问权限';
        exit();
    });

    Route::group('User', function () {
        Route::post('Register', '/Register'); //用户注册
        Route::post('Login', '/Login'); //用户登录
        Route::post('Forget', '/Forget'); //忘记找回密码
        Route::get('info', '/info'); //个人信息
        Route::rule('userauth', '/userauth'); //认证信息
        Route::rule('payment', '/payment'); //支付信息
        Route::rule('message', '/message'); //支付信息
        Route::get('machine', '/machine'); //矿机列表
        Route::post('buymachine', '/buymachine'); //矿机列表
        Route::post('infoEdit', '/infoEdit'); //矿机列表
        Route::get('mymachine', '/mymachine'); //矿机列表
        Route::rule('mypool', '/mypool'); //矿机列表
        Route::post('exchange', '/exchange'); //矿机列表
        Route::get('getaddress', '/getaddress'); //矿机列表
        Route::get('getrecharge', '/getrecharge'); //矿机列表
        Route::get('myteam', '/myteam'); //矿机列表
        Route::get('teamdata', '/teamdata'); //矿机列表
        Route::get('moneylog', '/moneylog'); //矿机列表
        Route::rule('withdrawal', '/withdrawal'); //矿机列表
        Route::get('withdrawallog', '/withdrawallog'); //矿机列表
        Route::get('userconfig', '/userconfig'); //矿机列表
    })->prefix('User');

    Route::group('Other', function () {
        Route::get('getcode', '/getcode'); //用户登录图形验证码
        Route::get('banner', '/banner'); //轮播图
        Route::get('annou', '/annou'); //文章资讯、公告
        Route::get('annoudetail', '/annoudetail'); //文章资讯、公告详情
        Route::get('kefu', '/kefu'); //客服列表
        Route::get('version', '/version'); //版本号
        Route::get('price', '/price'); //平台价格数据
        Route::post('sendMns', '/sendMns'); //平台价格数据
        Route::rule('oss', '/oss'); //平台价格数据
        Route::get('Quotes', '/Quotes'); //平台价格数据
        Route::get('QuotesIndex', '/QuotesIndex'); //平台价格数据
    })->prefix('Other');

    Route::group('Hall', function () {
        Route::get('lists', '/lists'); //  场外交易列表
        Route::post('input', '/input'); //  发布场外交易
        Route::post('cancel', '/cancel'); //  取消场外交易
        Route::post('match', '/match'); //  匹配场外交易订单
        Route::get('detail', '/detail'); //  获取交易订单详情
        Route::post('payment', '/payment'); //  确认付款交易订单
        Route::post('finish', '/finish'); //  确认交易完成
        Route::post('appeal', '/appeal'); //  交易申诉
        Route::post('cancel_match', '/cancel_match'); //  取消已匹配场外交易
        Route::get('hall', '/hall'); //  获取用户发布的场外交易
        Route::get('halltrade', '/halltrade'); //  获取交易记录
    })->prefix('Hall');
})->bind('api')->prefix('api');
